<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/struct_info.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
<script type="text/javascript" src="${staticServer}/common/uploadify/jquery.uploadify.js"></script>
<script type="text/javascript" src="${staticServer}/js/web/uploadImg.js?1.5"></script>
	
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/datepicker.js"></script>

<style>
#SWFUpload_0{
	margin-top: 70px;
    margin-left: -30px;
}
a{
	display: block;
	float: left;

}
</style>
<script>
var contextPath='${contextPath}';
var _contextPath = '${staticServer}';

$(function(){
	var id = $("#id").val();
	if(id!=null && id!=""){
		$("#jd_username1").val("<#if money??>${money.jd_username1}</#if>");
		$("#jd_username2").val("<#if money??>${money.jd_username2}</#if>");
		$("#jd_center_key").val("<#if money??>${money.jd_center_key}</#if>");
		$("#pra_type").val("<#if money??>${money.pra_type}</#if>");
		$("#moneyType1").val("<#if money??>${money.moneyType1}</#if>");
		$("#moneyType2").val("<#if money??>${money.moneyType2}</#if>");
		$("#state").val("<#if money??>${money.state}</#if>");
		
		var state = "<#if money??>${money.state}</#if>";
		if(state=="2"){
			$("#state").attr("disabled",true);
		}
		
		var pra_type = $("#pra_type").val();
		if(pra_type=="5"){
			$("#times2").show();
			$("#times2").val("<#if money??>${money.times}</#if>");
		}else{
			$("#times1").show("<#if money??>${money.times}</#if>");
			$("#times1").val("<#if money??>${money.times}</#if>");
		}
		
		var fp = "${fp}";
		if(fp=="1"){
			$("#fp_state").val(fp);
		}
	}else{
		$("#jd_username1").val("${webutil.getCookieUser().username}");
		$("#jd_center_key").val("${webutil.getCookieUser().region}");
	}
	
	$("#pra_type").val("<#if money??>${money.pra_type}</#if>");
	
	var keyname = $("#jd_center_key").val();
	if(keyname!=null && keyname!=""){
		$.post("${contextPath}/index/getMethod.json", {
			"keyname":keyname
		}, function(ms) {
			var list = ms.mList;
			var objHtml = '<option value="">请选择缴费类型</option>';
			for(var i=0;i<list.length;i++){
				objHtml +='<option value="'+list[i].id+'">'+list[i].name+'</option>';
			}
			$("#method").html('<select id="method_id" disabled>'+objHtml+'</select>');
			$("#method_id").val("<#if money??>${money.method_id}</#if>");
		});
	}
	
	$("#jd_center_key").change(function(){
		var keyname = $("#jd_center_key").val();
		$.post("${contextPath}/index/getMethod.json", {
			"keyname":keyname
		}, function(ms) {
			var list = ms.mList;
			var objHtml = '<option value="">请选择交款方式</option>';
			for(var i=0;i<list.length;i++){
				objHtml +='<option value="'+list[i].id+'">'+list[i].name+'</option>';
			}
			$("#method").html('<select id="method_id">'+objHtml+'</select>');
		});
	});
	
	$("#pra_type").change(function(){
		var pra_type = $("#pra_type").val();
		if(pra_type=="5"){
			$("#times2").show();
			$("#s_pra").show();
			$("#times1").hide();
			$("#moneyType1").val("2");
			$("#moneyType1").attr("disabled",true); 
		}else if(pra_type=="6"){
			$("#times1").hide();
			$("#times2").hide();
			$("#s_pra").hide();
		}else if(pra_type=="7" || pra_type=="9"){
			$("#times1").hide();
			$("#times2").hide();
			$("#moneyType1").hide();
			$("#moneyType2").hide();
			$("#s_pra").show();
		}else{
			if(pra_type=="8"){
				$("#moneyType1").val("1");
				$("#moneyType1").attr("disabled",true); 
			}else{
				$("#moneyType1").attr("disabled",false); 
			}
			$("#times1").show();
			$("#s_pra").show();
			$("#times2").hide();
		}
	});
	
	
});

	
   		

var addMoneys = function(){
	var id = $("#id").val();
	var state = $("#state").val();
	var state_beizhu = $("#state_beizhu").val();
	var pz_url = $("#pz_url").val();
	var fw_url = $("#fw_url").val();
	var jg_type = $("#jg_key").val();

	if(state=="" || state=="0"){
		infopad.err("请选择审核!");
		return;
	}
	

	$.post("${contextPath}/index/money_state.json", {
			"id":id,
			"state":state,
			"state_beizhu":state_beizhu,
			"jg_type":jg_type

		}, function(ms) {
		    var msg = ms.msg;
		    if(msg!=null && msg=="1"){
				infopad.msg("操作成功！");
				window.location.href="${contextPath}/index/moneyList.htm";
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

var addFpState = function(){
	var id = $("#id").val();
	var fp_state = $("#fp_state").val();

	if(fp_state=="" || fp_state=="0"){
		infopad.err("请选择审核状态!");
		return;
	}
	
	$.post("${contextPath}/index/fp_state.json", {
			"id":id,
			"fp_state":fp_state
		}, function(ms) {
		    var msg = ms.msg;
		    if(msg!=null && msg=="1"){
				infopad.msg("操作成功！");
				window.location.href="${contextPath}/index/fapiaoList.htm";
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

var addZonMoney = function(){
	var id = $("#id").val();
	var fp_moneys = $("#fp_moneys").val();
	
	$.post("${contextPath}/index/updateZonMoney.json", {
			"id":id,
			"fp_moneys":fp_moneys
		}, function(ms) {
		    var msg = ms.mgs;
		    if(msg!=null && msg=="1"){
				infopad.msg("操作成功！");
				window.location.href="${contextPath}/index/moneyList.htm";
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

</script>
</head>
<input type="hidden" id="id" value="<#if money??>${money.id}</#if>">
<input type="hidden" id="stu_id" value="<#if student??>${student.id}</#if>">
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>组织架构</li>
			<li>&gt;</li>
			<li class="current">title</li>
		</ul>
	</div>

	<div id="container">
		<div id="title">给学员（<#if student??>${student.nickname}</#if>）添加缴费记录</div>
		<table id="infotable">
			
			<tr>
				<th>接待咨询师:</th>
				<td>
				<select id="jd_username1" disabled>
						<option value="">-- 请选择接待老师1 --</option>
						<#if uList??>
							<#list uList as list>
								<option value="${list.username}">${list.nickname}（${list.regions}-${list.job}）</option>
							</#list>
						</#if>
				</select>
				<select id="jd_username2" disabled>
						<option value="">-- 请选择接待老师2 --</option>
						<#if uList??>
							<#list uList as list>
								<option value="${list.username}">${list.nickname}（${list.regions}-${list.job}）</option>
							</#list>
						</#if>
				</select>
				训练老师：<#if money.record_teacher??>${money.record_teacher}<#else>无</#if>
				</td>
			</tr>
			 <#if webutil.getCookieUser().username=="yuanjing" |  webutil.getCookieUser().username=="wangjiawei">
				<tr>
				<th>添加机构:</th>
				<td>
				<select id="jg_key">
					<option value="">请选择机构</option>
					
							<option value="0">北京教育联展网</option>
							<option value="1">杭州教育联展网</option>
							<option value="2">南京教育联展网</option>
							<option value="3">苏州教育联展网</option>
							<option value="4">天津教育联展网</option>
							<option value="5">上海教育联展网</option>
							<option value="6">广州教育联展网</option>
							<option value="7">长沙教育联展网</option>
							<option value="8">深圳教育联展网</option>
							<option value="9">重庆教育联展网</option>
							<option value="10">武汉教育联展网</option>
							
								<option value="11">培训世界</option>
							<option value="12">教头网</option>
							<option value="13">坦途教育网</option>
							<option value="14">培训通（杭州、宁波、上海）</option>
							<option value="15">培训通（除三个城市以外）</option>
							<option value="16">搜学校</option>
							<option value="17">返学费网</option>
							<option value="18">教育宝</option>
							<option value="19">报名在线网</option>
							<option value="20">哈哈儿童网</option>
							
				
				</select>
				</td>
			
			</tr>
			 </#if>
			<tr>
				<th>缴费中心:</th>
				<td>
				<select id="jd_center_key" disabled>
					<option value="">请选择中心</option>
					<#if offList??>
						<#list offList as list>
							<option value="${list.keyname}">${list.name}</option>
						</#list>
					</#if>
				</select>
				</td>
			</tr>
			
			<tr>
				<th>课程类型:</th>
				<td>
					<select id="pra_type" disabled>
						<option value="">请选择课程</option>
						<option value="1">非脑电</option>
						<option value="2">普通中心</option>
						<option value="3">全脑</option>
						<option value="4">太优</option>
						<option value="5">家庭训练</option>
						<option value="6">夏令营</option>
						<option value="7">上门费</option>
						<option value="8">暑期培优班(新)</option>
						<option value="9">暑期培优班(旧)</option>
						<option value="10">寒假培优班</option>
					</select>
					<select id="times1" style="display:none" disabled>
						<option value="">次数</option>
						<option value="10">10次</option>
						<option value="14">14次</option>
						<option value="15">15次</option>
						<option value="20">20次</option>
						<option value="30">30次</option>
						<option value="40">40次</option>
						<option value="45">45次</option>
						<option value="60">60次</option>
						<option value="90">90次</option>
						<option value="120">120次</option>
						<option value="150">150次</option>
						<option value="180">180次</option>
						<option value="210">210次</option>
						<option value="240">240次</option>
						<option value="270">270次</option>
						<option value="300">300次</option>
					</select>
					<select id="times2" style="display:none" disabled>
						<option value="">月数</option>
						<option value="3">3月</option>
						<option value="6">6月</option>
						<option value="12">12月</option>
					</select>
					<input id="s_pra" readonly="" type="text" value="<#if money??>${money.s_pra}</#if>" placeholder="赠送课时次数" size="30" />
				</td>
			</tr>
			
			<tr>
				<th>缴费类型:</th>
				<td>
					<select id="moneyType1" disabled>
						<option value="">缴费类型1</option>
						<option value="1">新增</option>
						<option value="2">续费</option>
					</select>
					<select id="moneyType2" disabled>
						<option value="">缴费类型2</option>
						<option value="1">定金</option>
						<option value="2">部分款</option>
						<option value="3">全款</option>
						<option value="4">尾款</option>
					</select>
					
				</td>
			</tr>
			
			<tr>
				<th>交款方式/金额:</th>
				<td>
					<span id="method">
					</span>
					交款金额：<input id="moneys" readonly="" type="text" value="<#if money??>${money.moneys}</#if>" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')" size="10" maxlength="30" />元，
					课程全款金额：<input id="fp_moneys" type="text" value="<#if money??>${money.fp_moneys}</#if>" placeholder="课程全款金额" size="10" />元。
					<br/><br/>
					<input id="beizhu" readonly="" placeholder="交款备注" type="text" value="<#if money??>${money.beizhu}</#if>" size="46" maxlength="100" />
					
				</td>
			</tr>
			
			<tr>
				<th>上门费:</th>
				<td>
					<input id="smf_c" readonly="" type="text" placeholder="上门次数" value="<#if money??>${money.smf_c}</#if>" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')" size="20" maxlength="100" />次
					<input id="smf_m" readonly="" type="text" placeholder="上门费用" value="<#if money??>${money.smf_m}</#if>" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')" size="20" maxlength="100" />元。
				</td>
			</tr>
			
			<tr>
				<th>收据编号:</th>
				<td>
					<input id="sj_num" readonly="" type="text" placeholder="如果没有收据编号，请填写：无" value="<#if money??>${money.sj_num}</#if>" size="46" maxlength="100" />
				</td>
			</tr>
			
			<tr>
				<th>上传凭证:</th>
				<td>
					<ul class="imglist">
					<div id="images" style="float: left;">
						<#if money?? && money.pz_url?? && money.pz_url!="">
							<#list money.pz_url?split(",") as imgurl>
								<#if imgurl_index !=0>
								<li style="float:left;list-style-type: none;line-height:140px;*font-size:157px;"> <a   href="http://120.55.241.58/${imgurl}"><img rel="800:485" width="180" height="109.125" src="http://120.55.241.58/${imgurl}"></a> </li>
								</#if>
							</#list>
						</#if>
					</div>
					</ul>
					<input type="text" style="display:none;" id="pz_url" value="<#if money??>${money.pz_url}</#if>" class="DatePicker_Icon">
				</td>
			</tr>
			<tr>
				<th>上传服务协议:</th>
				<td>
					<ul class="imglist">
					<div id="images" style="float: left;">
						<#if money?? && money.fw_url?? && money.fw_url!="">
							<#list money.fw_url?split(",") as imgurl>
								<#if imgurl_index !=0>
								<li style="float:left;list-style-type: none;line-height:140px;*font-size:157px;"><a  href ="http://120.55.241.58/${imgurl}" ><img rel="800:485" width="180" height="109.125" src="http://120.55.241.58/${imgurl}"></a></li>
								</#if>
							</#list>
						</#if>
					</div>
					</ul>
					<input type="text" style="display:none;" id="fw_url" value="<#if money??>${money.fw_url}</#if>" class="DatePicker_Icon">
				</td>
			</tr>
			<tr>
				<th>交款日期:</th>
				<td style="height:20px;">
					<input type="text" id="moneyDate" value="<#if money??>${money.moneyDate?date}</#if>" size="15" maxlength="15" readonly="readonly" class="DatePicker_Icon">
				</td>
			</tr>
			
			<#if fp?? && fp=="1">
			<tr>
				<th>审核状态:</th>
				<td style="height:20px;">
					<select id="fp_state">
						<option value="0">请选择</option>
						<option value="1">未通过</option>
						<option value="2">已通过</option>
					</select>
				</td>
				</td>
			</tr>
			<#else>
			<tr>
				<th>审核/备注:</th>
				<td style="height:20px;">
					<select id="state">
						<option value="0">请选择</option>
						<option value="1">未通过</option>
						<option value="2">已通过</option>
					</select>
					<input id="state_beizhu" placeholder="家长以现金方式缴费的 备注清楚存回公司的方式（支付宝、银行卡转账等）" type="text" value="<#if money??>${money.state_beizhu}</#if>" size="70" maxlength="100" />
				
				</td>
				</td>
			
			</tr>
			</#if>
			
			
		</table>
		<div id="controlbar">
		<#if fp?? && fp=="1">
			<input type="button" class="submit" onclick="addFpState()" value="  保  存  " />
		<#else>
			<input type="button" class="submit" onclick="addMoneys()" value="  保  存  " />
		</#if>
		<#if webutil.getCookieUser().username=="wangjiawei" || webutil.getCookieUser().username=="system">
			<input type="button" class="submit" onclick="addZonMoney()" value="  保存总金额  " />
		</#if>
		</div>
	</div>
	
</body>
</html>